package com.dy.project.controller;

import com.dy.project.domain.CommoditySignBatchOperationTemplate;
import com.dy.project.domain.CommoditySignGroupTemplate;
import com.dy.project.domain.CommoditySignTemplate;
import com.dy.project.domain.McCommoditySign;
import com.dy.project.service.IMcCommoditySignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

/**
 * 商品签收Controller
 * 
 * @author ruoyi
 * @date 2020-07-29
 */
@RestController
@RequestMapping("/commodity/commoditySign")
public class McCommoditySignController
{
    @Autowired
    private IMcCommoditySignService mcCommoditySignService;

    /**
     * 查询商品签收列表组
     */
    @GetMapping("/listGroup")
    public List<CommoditySignGroupTemplate> listGroup(CommoditySignGroupTemplate commoditySignGroupTemplate)
    {
        return mcCommoditySignService.selectMcCommoditySignListGroup(commoditySignGroupTemplate);
    }

    /**
     * 查询商品编号签收列表组
     */
    @GetMapping("/listGroupByAcId")
    public List<CommoditySignGroupTemplate> listGroupByAcId(CommoditySignGroupTemplate commoditySignGroupTemplate)
    {
        return mcCommoditySignService.selectCommoditySignListGroupByAcId(commoditySignGroupTemplate);
    }

    /**
     * 批量刪除/補貨貨物
     */
    @PostMapping("/handleSignCommodityBatch")
    public int handleSignCommodityBatch(@RequestBody CommoditySignBatchOperationTemplate commoditySignBatchOperationTemplate)
    {
        return mcCommoditySignService.handleSignCommodityBatch(commoditySignBatchOperationTemplate);
    }

    /**
     * 查询商品签收列表组
     */
    @GetMapping("/listCommoditySignTemplate")
    public List<CommoditySignTemplate> listCommoditySignTemplate(CommoditySignTemplate commoditySignTemplate)
    {
        return mcCommoditySignService.listCommoditySignTemplate(commoditySignTemplate);
    }


    @PostMapping("/updateSignDtlState")
    public int updateSignDtlState(@RequestBody HashMap<String,Object> params)
    {
        return mcCommoditySignService.updateSignDtlState(params);
    }

    @PostMapping("/sign")
    public int sign(@RequestBody McCommoditySign mcCommoditySign)
    {
        return mcCommoditySignService.sign(mcCommoditySign);
    }

    @PostMapping("/signAll")
    public int signAll(@RequestBody List<McCommoditySign> mcCommoditySignList)
    {
        return mcCommoditySignService.signAll(mcCommoditySignList);
    }

    @PostMapping("/updateSignCount")
    public int updateSignCount(@RequestBody McCommoditySign commoditySign)
    {
        return mcCommoditySignService.updateSignCount(commoditySign);
    }
}
